package oss.ngocminh.fw.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class DatabaseHelper extends SQLiteOpenHelper {

	public DatabaseHelper(Context context) {
		super(context, "fw", null, 1);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL("CREATE TABLE " + SubscriptionDAO.TABLE_NAME + " (" +
				"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
				SubscriptionDAO.USER_NAME + " TEXT," +
				SubscriptionDAO.PASSWORD + " TEXT," +
				SubscriptionDAO.THREAD_ID + " INTEGER," +
				SubscriptionDAO.LAST_READ_POST_ID + " TEXT);");
		db.execSQL("CREATE TABLE thread (" +
				"_id INTEGER PRIMARY KEY AUTOINCREMENT," +
				"title TEXT," +
				"base_url TEXT," +
				"thread_id TEXT," +
				"page_count INTEGER);");
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, 
			int newVersion) {
		// nothing to do yet
	}

}
